package com.guxingke.gblog.service.impl;

import java.util.List;

import com.guxingke.gblog.dao.FriendLinkDao;
import com.guxingke.gblog.dao.impl.FriendLinkDaoImpl;
import com.guxingke.gblog.dmo.FriendLink;
import com.guxingke.gblog.service.FriendLinkService;

public class FriendLinkServiceImpl implements FriendLinkService {
	private FriendLinkDao friendLinkDao = null;

	 public FriendLinkServiceImpl() {
		 friendLinkDao = new FriendLinkDaoImpl();
	}
	
	@Override
	public List<FriendLink> getFriendLinks() {

		List<FriendLink> friendLinks = null;
		try {
			friendLinks = friendLinkDao.all();
		} catch (Exception e) {
			e.printStackTrace();
		}

		return friendLinks;
	}

	@Override
	public void updateFriendLink(FriendLink friendLink) {

		try {
			this.friendLinkDao.update(friendLink);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	@Override
	public void saveFriendlink(FriendLink friendLink) {

		try {
			this.friendLinkDao.save(friendLink);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	@Override
	public void deleteFriendLink(Integer id) {

		try {
			this.friendLinkDao.delete(id);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	@Override
	public FriendLink getFriendLink(int id) {

		FriendLink friendLink = null;
		try {
			friendLink = friendLinkDao.get(id);
		} catch (Exception e) {
			e.printStackTrace();
		}

		return friendLink;
	}
}
